//
//  ZTFindDetailViewCell.m
//  XMLYFM
//
//  Created by dllo on 15/12/23.
//  Copyright © 2015年 zzl. All rights reserved.
//

#import <UIImageView+WebCache.h>
#import "ZTFindDetailViewCell.h"
#import <Masonry.h>
@implementation ZTFindDetailViewCell

-(instancetype)initWithFrame:(CGRect)frame
{

    if (self = [super initWithFrame:frame]) {
        [self creatSubViews];
    }
    return self;
    
}

-(void)creatSubViews
{
    self.newsPic = [[UIImageView alloc]init];
    self.newsPic.backgroundColor = [UIColor yellowColor];
    [self.contentView addSubview:self.newsPic];
  
    [self.newsPic mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.mas_left).offset(3);
        make.top.mas_equalTo(self.mas_top).offset(3);
        make.size.mas_equalTo(CGSizeMake(TZWIDTH*0.18, TZWIDTH*0.18));
        
    }];
    
    
    
    self.newsTitle = [[UILabel alloc]init];
    [self.contentView addSubview:self.newsTitle];
    
    [self.newsTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.newsPic).offset(TZWIDTH*(0.18+0.03));
        make.top.equalTo(self.newsPic).offset(TZWIDTH * 0.02);
        make.size.mas_equalTo(CGSizeMake(200, 20));
        
    }];
    
    
    self.newsDigest = [[UILabel alloc]init];
    [self.contentView addSubview:self.newsDigest];
    
    [self.newsDigest mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.newsPic).offset(TZWIDTH*0.18+10);
        make.top.equalTo(self.newsTitle).offset(20 + 20);
        make.size.mas_equalTo(CGSizeMake(200, 20));
    }];
    
}

-(void)setFindModel:(TZfindModel *)findModel
{

    NSString *imgStr = findModel.coverPath;
    NSURL *urlImg = [NSURL URLWithString:imgStr];
    [self.newsPic sd_setImageWithURL:urlImg placeholderImage:nil];
    
    
    self.newsTitle.text = findModel.title;
    self.newsDigest.text = findModel.subtitle;
    

}









@end
